from sqlalchemy import Column, ForeignKey, String
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import relationship

from app.db.base_class import Base
from app.models import PersonalizedWordLibrary
from app.models.archivable import Archivable

# 个性化词汇模型
class PersonalizedVocabulary(Base, Archivable):

    __tablename__ = 'personalized_vocabulary'
    # 分类名称
    category_name = Column(String, comment="分类名称")
    # category_id = Column(UUID(as_uuid=True), ForeignKey('personalized_word_library.id'), nullable=False)

    # category_name = Column(String, ForeignKey("personalized_word_library.category_name"), nullable=True,
    #                        comment="分类名称")
    #词库内容
    content = Column(String, nullable=True, comment="内容")
    # 用户id
    user_id = Column(UUID(as_uuid=True), ForeignKey("user.id"))

    # 与个性化词库分类库模型的关系
    # category = relationship("PersonalizedWordLibrary", back_populates="vocabularies")